package com.lib.common.view;

import android.content.Context;
import androidx.appcompat.widget.AppCompatTextView;
import android.text.Html;
import android.util.AttributeSet;

/**
 * @author 一叶丶枫凌
 * Created on 2017-05-20 14:01
 */
public class WithStarTextView extends AppCompatTextView {
	
	public WithStarTextView(Context context) {
		
		this(context, null);
	}
	
	public WithStarTextView(Context context, AttributeSet attrs) {
		
		this(context, attrs, 0);
	}
	
	public WithStarTextView(Context context, AttributeSet attrs, int defStyle) {
		
		super(context, attrs, defStyle);
	}
	
	@Override
	public void setText(CharSequence text, BufferType type) {
		
		// text = "<font color=\"#ff0000\">*</font>".append(text.toString());
		text = new StringBuilder(text).insert(text.length() - 1, "<font color=\"#ff0000\">*</font>");
		super.setText(Html.fromHtml(text.toString()), type);
	}
}
